package com.yan.watch.rxjava;


import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

@SuppressWarnings("all")
public class WeChatUser implements Observer<String> {
    private String name;
    private Disposable d;

    public WeChatUser(String name) {
        this.name = name;
    }

    @Override
    public void onSubscribe(Disposable d) {
        this.d = d;
    }

    @Override
    public void onNext(String value) {
        System.out.println("微信用户" + name + "收到消息：\n" + value);
    }

    @Override
    public void onError(Throwable throwable) {

    }

    @Override
    public void onComplete() {
        System.out.println("onComplete");
    }

    public void dispose() {
        d.dispose();
    }
}
